<template>
	<uni-nav-bar dark :fixed="true" shadow background-color="#fff" status-bar left-icon="left" @clickLeft="back" />
	<view class="tips">
		该手机号已被微信号绑定，无需添加
	</view>
	<view class="phone">
		<view class="item">
			<view class="name">手机号码：</view>
			<input type="text" placeholder="点击右侧授权手机号">
			<view class="btn">
				<button open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">绑定手机号</button>
			</view>
		</view>
	</view>
	<view class="setting-button" @click="back">
		<view class="logo">返回</view>
	</view>
</template>
<script setup>
import { ref, reactive } from 'vue';
import { bindPhoneMini } from '@/request/api/login.js';


const basicData = reactive({
	text: '获取手机号',
	value: ''
});

// 获取手机
const getPhoneNumber = async (e) => {
	const data = await bindPhoneMini({ code: e.detail.code })
	
	uni.showToast({
		title: '绑定成功!',
		icon: 'success',
		duration: 2000
	});
	
	setTimeout(() => {
		uni.navigateBack({
			delta: 1
		})
	}, 2000)
}

const toPage = (item) => {
	uni.navigateTo({
		url: item.url
	})
}

const back = () => {
	uni.navigateBack({
		delta: 1
	})
}
</script>

<style lang="scss" scoped>
	.tips {
		color: #fff;
		width: 702rpx;
		height: 78rpx;
		background: #FF6862;
		border-radius: 16rpx;
		text-align: center;
		line-height: 78rpx;
		margin: 0 auto;
		font-size: 26rpx;
		font-family: PingFangSC-Medium, PingFang SC;
		font-weight: 500;
	}
	.phone {
		padding: 0rpx 82rpx;
		box-sizing: border-box;
		.item {
			width: 100%;
			height: 100rpx;
			display: flex;
			align-items: center;
			position: relative;
			border-bottom: 2rpx solid #E5E4E4;
			.name {
				width: 150rpx;
				font-size: 26rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #1C1919;
				line-height: 36rpx;
			}
			input {
				font-size: 26rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #9E9E9E;
				line-height: 36rpx;
			}
			.text {
				flex: 1;
			}
			.btn {
				position: absolute;
				top: 20rpx;
				right: 0rpx;
				height: 56rpx;
				padding: 0rpx 18rpx;
				line-height: 56rpx;
				list-style: 62rpx;
				text-align: center;
				background: #000000;
				border-radius: 46rpx;
				font-size: 26rpx;
				font-weight: 400;
				color: #FFFFFF;
			}
		}
	}
	
	.setting-button {
		position: fixed;
		width: 100%;
		bottom: 100rpx;
		margin: 0 auto;
		padding: 0rpx 56rpx;
		box-sizing: border-box;
		.logo {
			height: 92rpx;
			background: #000000;
			border-radius: 46rpx;
			line-height: 92rpx;
			font-size: 32rpx;
			color: #fff;
			text-align: center;
		}
	}
	
	::v-deep button {
		margin: 0 !important;
		background-color: transparent !important;
		border: 1rpx solid transparent;
		font-size: 24rpx !important;
		font-weight: 400 !important;
		padding: 0rpx !important;
		display: flex;
		align-items: center;
		color: #fff;
	}
	::v-deep button::after { 
	    border: none
	}
</style>

